package com.leyou.favorite.mapper;

import com.leyou.favorite.pojo.Favorite;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * @author CHERRY
 * @date 2018-09-21-14:25
 */
@Repository
public interface FavoriteMapper extends Mapper<Favorite> {

    /**
     * 倒序查询用户所有的收藏信息
     *
     * @param id
     * @return
     */
    @Select("SELECT * FROM tb_collections WHERE user_id = #{id} ORDER BY create_time DESC;")
    List<Favorite> selectFavoriteByUserIdAndDesc(@Param("id") Long id);
}
